#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char* argv[])
{
	/*int fd= 0;
	char buffer[1024] = {0};
	int nRead = 0;
	if((fd = open ("/proc/power", S_IRUSR | S_IROTH)) < 0 )
	{
		printf("open fail\n");
		return 0;
	}
	nRead = read(fd, buffer, 1024);
	if(nRead > 0)
	{
		printf("%d bytes Read:\n%s", nRead, buffer);
	}
	close(fd);*/
	FILE *fp;
	char line[1024*1024];
	char record[1024*1024];
	size_t len = 0;
	ssize_t read;

	if( (fp = fopen( "/proc/power", "r" )) != NULL )
	{
		 len = fread( line, 1, 1024*1024, fp );
				printf( "len:%d,%s", len, line);
		/*//while(!feof(fp)){
		while(1) {
			if( fgets( line, 512, fp ) != NULL)
				printf( "%s", line);
			else {
				printf( "fgets error\n" );
				break;
			}
		}*/
		printf("Finish reading\n");
		fclose( fp );
	}
	return 1;
}
